<?php
$ver = 32;
date_default_timezone_set('PRC');
defined('BASE_PATH') || define('BASE_PATH', getenv('BASE_PATH') ?: realpath(dirname(__FILE__) . '/../..'));
defined('APP_PATH') || define('APP_PATH', BASE_PATH . '/app');

$config = new \Phalcon\Config([
    'application' => [
        'appDir'                => APP_PATH . '/',
        'modelsDir'             => APP_PATH . '/common/models/',
        'cacheDir'              => BASE_PATH . '/cache/',
        'baseUri'               => preg_replace('/(public)*([\/\\\\])index.php$/', '', $_SERVER["PHP_SELF"]) ?: '/'
    ],
    'printNewLine' => true
]);
$config->merge(new \Phalcon\Config\Adapter\Ini(BASE_PATH . '/web.ini'));

defined('APP_DEV') || define('APP_DEV', $config->get('APP_DEV') || false);
error_reporting(APP_DEV || isset($_REQUEST['dev']) ? E_ALL : E_ERROR);
defined('VER') || define('VER', APP_DEV ? time() : $ver);
defined('CACHE_PATH') || define('CACHE_PATH', $config->get('application')->get('cacheDir'));
defined('TEMP_PATH') || define('TEMP_PATH', CACHE_PATH . 'temp');

return $config;
